<template>
  <div class="footprintBox">
    <x-header :left-options="{showBack: true,backText:''}" class="headerBox">
      <span>足迹</span>
      <div slot="right" class="headRight">
        <img src="../assets/images/nav-more2.png" alt @click="menuNav=!menuNav" />
      </div>
    </x-header>
    <x-dialog
      v-model="menuNav"
      :dialog-style="{'max-width': '100%', width: '100%', height: '100%', 'background-color': 'transparent'}"
      class="menuNavBox"
    >
      <div class="closeBox">
        <img src="../assets/images/close-nav2.png" alt @click="menuNav=false" />
      </div>
      <div class="menuContent">
        <div class="menuTitle">快速导航</div>
        <div class="menuList clearfix">
          <router-link to="/" class="menuItem">
            <img src="../assets/images/nav-index.png" alt />
            <div>首页</div>
          </router-link>
          <router-link to="cart" class="menuItem">
            <img src="../assets/images/nav-cart.png" alt />
            <div>购物车</div>
          </router-link>
          <router-link to="search" class="menuItem">
            <img src="../assets/images/nav-search.png" alt />
            <div>搜索</div>
          </router-link>
          <router-link to="classify" class="menuItem">
            <img src="../assets/images/nav-cate.png" alt />
            <div>全部分类</div>
          </router-link>
          <router-link to="mine" class="menuItem">
            <img src="../assets/images/nav-my.png" alt />
            <div>我的易购</div>
          </router-link>
        </div>
      </div>
    </x-dialog>
    <Calendar v-on:choseDay="clickDay" v-on:changeMonth="changeDate" v-on:isToday="clickToday"></Calendar>
    <!-- 足迹列表 -->
    <div  class="contBox">
      <div v-for="(item,index) in goodsList" :key="index" class="goodsList flex">
        <img :src="item.img" alt class="goodsImg" />
        <div class="introduce">
          <div class="title">{{item.title}}</div>
          <div class="price">¥{{item.money}}</div>
          <div class="footer flex_sb">
            <router-link to class="resemble">找相似</router-link>
            <div @click="starClick(item.collection)" >
                <div @click="item.collection=!item.collection" class="starBox" :class="item.collection==true?'active':''">★</div> 
            </div>

          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Calendar from 'vue-calendar-component'
import { XHeader, XDialog } from 'vux'

export default {
  components: {
    Calendar,
    XHeader,
    XDialog,
  },
  data() {
    return {
      menuNav: false,
      goodsList: [
        {
          img: require('../assets/images/156939384936042029.jpg'),
          title:
            '【假一赔十】索尼（SONY）WF-1000XM3 真无线蓝牙降噪耳机 入耳式运动耳麦降噪豆 1000X第三代 铂金银',
          money: '499.00',
          collection: false
        },
        {
          img: require('../assets/images/157136450994431031.png'),
          title:
            '【假一赔十】索尼（SONY）WF-1000XM3 真无线蓝牙降噪耳机 入耳式运动耳麦降噪豆 1000X第三代 铂金银',
          money: '499.00',
          collection: false
        }
      ]
    }
  },

  methods: {
    clickDay(data) {
      this.$vux.toast.show({
        width: '70%',
        type: 'text',
        text: `${data} 这天还没有足迹哦`
      })
    },
    changeDate(data) {
      console.log(data) //左右点击切换月份
    },
    clickToday(data) {
      console.log(data) //跳到了本月
    },
    starClick(data) {
      if (data) {
        this.$vux.toast.show({
          width: '30%',
          type: 'text',
          text: '已关注'
        })
      }
    }
  }
}
</script>

<style lang="less" scoped>
.footprintBox {
  // 头部导航
  /deep/.headerBox {
    z-index: 9;
    background-color: transparent;
    .vux-header-left {
      left: 24px;
      .vux-header-back {
        color: #000;
      }
      .left-arrow:before {
        border-color: #000;
      }
    }
    .vux-header-title {
      color: #000;
      margin: 0 100px;
    }
    .headLeft {
      img {
        width: 60px;
        margin-top: -16px;
      }
    }
    .headRight {
      img {
        width: 60px;
        margin-top: -16px;
      }
    }
    .hotHint {
      width: 450px;
      margin-top: 15px;
    }
  }
  // 头部菜单弹框
  .menuNavBox {
    .closeBox {
      text-align: right;
      margin-top: 10px;
      margin-right: 30px;
      img {
        width: 60px;
      }
    }
    .menuContent {
      margin: 20px;
      padding: 20px;
      border-radius: 20px;
      background-color: #fff;
      position: relative;
      &::before {
        border-bottom: 20px solid #fff;
        border-left: 20px solid transparent;
        border-right: 20px solid transparent;
        display: block;
        content: '';
        position: absolute;
        top: -20px;
        right: 24px;
      }
      .menuTitle {
        font-size: 30px;
        padding: 20px;
        text-align: left;
      }
      .menuList {
        .menuItem {
          float: left;
          width: 23%;
          margin: 1%;
          background-color: #f7f7f7;
          padding: 20px;
          box-sizing: border-box;
          border-radius: 20px;
          img {
            width: 50%;
          }
          div {
            color: #666;
          }
        }
      }
    }
  }
  //   足迹列表
  .contBox {
    margin-top: 20px;
    padding: 20px;
    border-radius: 20px;
    background-color: #f8f9fa;
    .goodsList {
      margin-bottom: 20px;
      padding: 20px;
      background-color: #fff;
      border-radius: 20px;
      .goodsImg {
        width: 200px;
        height: 200px;
        flex-shrink: 0;
      }
      &:last-child {
        margin-bottom: 0;
      }
      .introduce {
        margin-left: 20px;
        flex-grow: 1;
        .title {
          font-size: 30px;
          text-overflow: -o-ellipsis-lastline;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          line-clamp: 2;
          -webkit-box-orient: vertical;
          height: 100px;
          overflow: hidden;
        }
        .price {
          margin-bottom: 10px;
          font-size: 36px;
          color: #ee3a0d;
        }
      }

      .footer {
        .resemble {
          border: 2px solid #000;
          padding: 0 10px;
          border-radius: 20px;
        }
        .starBox {
            color: rgb(165, 164, 164);
            font-size: 34px;
        }
        .starBox.active {
            color: #f55055;
        }
      }
    }
  }
}
</style>